package com.tiancheng.onecode.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Optional;

/**
 * @Author: kellen
 * @Description: 商户进件状态（详细状态）
 * @Date: create in 2025/02/08 14:00
 */
@Getter
@AllArgsConstructor
public enum MerchantRegStatusEnums implements BaseEnum<Integer> {
    INIT(0, "已提交资料"),
    CERTIFICATE_VERIFICATION_FAILED(1, "资料验证失败"),
    CERTIFICATE_VERIFICATION_SUCCESS(2, "资料验证成功"),
    CORPORATE_ACCOUNT_VERIFICATION(3, "等待对公账户待验证"),
    CORPORATE_ACCOUNT_VERIFICATION_ING(4, "对公账户验证申请中"),
    CORPORATE_ACCOUNT_VERIFICATION_SUCCESS(5, "对公打款验证-成功"),
    CORPORATE_ACCOUNT_VERIFICATION_FAIL(6, "对公打款验证-失败"),

    SMS_VERIFICATION(7,"短信验证中"),
    SMS_VERIFICATION_SUCCESS(8,"短信验证成功！"),
    SMS_VERIFICATION_ERROR(9,"短信验证失败！"),

    SIGNING_IN_PROGRESS(10, "等待前台签约"),
    SIGNING_IN_FAIL(11, "前台签约-失败"),
    PROCESS_CANCEL(12, "流程作废，请重新发起"),
    PROCESS_COMPLETED(100, "流程成功结束"),
    ;

    private final Integer code;
    private final String name;

    public static String getDescByCode(Integer code){
        Optional<MerchantRegStatusEnums> first = Arrays.stream(MerchantRegStatusEnums.values()).filter(m -> m.getCode().equals(code)).findFirst();
        return first.isEmpty()?"":first.get().getName();
    }
}
